﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Windows.Forms;
namespace F1010DB.Common
{
    public class CustomColumn
    {
        private Dictionary<string, string> dataColumn;

        public CustomColumn()
        {

        }


        public CustomColumn(Dictionary<string, string> dataColumn)
        {
            this.dataColumn = dataColumn;
        }
        public void customColumnAndDefineIt(DataGridView grView)
        {
         

            if (dataColumn == null)
            {
                return;
            }

            foreach(string key in dataColumn.Keys)
            {
                DataGridViewTextBoxColumn column = new DataGridViewTextBoxColumn();

                column.HeaderText = dataColumn[key];
                column.DataPropertyName = key;

                grView.Columns.Add(column);
            }

            grView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells;
        }

    }
}
